package com.seven.restaurant.entity.request;

import com.seven.restaurant.annotation.ExistId;
import com.seven.restaurant.mapper.FoodMapper;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

/**
 * 食物类请求
 * @author BaiBan
 * @since 2022/7/21
 */
@Data
public class FoodRequest {
    
    /**
     * 主键
     */
    @ExistId(value = FoodMapper.class, message = "菜品不存在", groups = UpdateGroup.class)
    @Null(message = "创建时id必须为null", groups = CreateGroup.class)
    @NotNull(message = "修改时id必须不为null", groups = UpdateGroup.class)
    private Long id;

    /**
     * 菜品名称
     */
    @NotBlank(message = "菜品名称不许为空", groups = CreateGroup.class)
    private String name;

    /**
     * 图片链接
     */
    @URL(message = "菜品图片必须是一个url", groups = CreateGroup.class)
    private String icon;

    /**
     * 菜品种类
     */
    @NotBlank(message = "菜品菜系不许为空", groups = CreateGroup.class)
    private String type;

    /**
     * 简介
     */
    private String briefIntroduction;

    /**
     * 价格
     */
    @Min(value = 0, message = "价格不能低于0元", groups = CreateGroup.class)
    private Integer price;
}
